import { Button, DatePicker } from 'antd-mobile'
import { useState } from 'react'
import styles from './index.module.scss'

export default function Test() {
  const [visible, setVisible] = useState(false)

  const handleConfirm = (value: Date) => {
    console.log(value)
  }

  return (
    <div className={styles.root}>
      <DatePicker
        visible={visible}
        min={new Date('1940-01-01')}
        max={new Date()}
        onClose={() => setVisible(false)}
        onConfirm={(e) => handleConfirm(e)}
        defaultValue={new Date('2020-01-01')}
      />
      <Button color="primary" onClick={() => setVisible(true)}>
        点我
      </Button>
    </div>
  )
}
